home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 21
/
Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso
/
Aminet
/
comm
/
www
/
1stLinkChecker.lha
/
1st_LinkChecker
/
LinkChecker
< prev
next >
Wrap
Text File
|
1997-08-08
|
4KB
|
176 lines
/* Optimized with RexxOpt 1.7 */
NL='0A'X
TempFile="ram:HTMLfound"
say "************************************************"
say "*
Local Link Checker
V1.3 (08/07/97) *"
say "* © Heiko Schröder (age@thepentagon.com) *"
say "************************************************"||NL
if ~show('L',"rexxreqtools.library") then;do
if ~addlib('rexxreqtools.library',0,-30,0) then;do
say "You need LIBS:rexxreqtools.library. Cancel"
Call Fini
END
END
Ext.0=6
Ext.1="HTTP://"
Ext.2="FTP://"
Ext.3="GOPHER://"
Ext.4="MAILTO:"
Ext.5="NEWS:"
Ext.6="ABOUT:"
verz=GetClip("xdir")
dir=rtfilerequest(verz,,"Where can I search? Pick Dir and OK",,"rtfi_flags = freqf_nofiles")
if rtresult=0 then;do
echo "Cancel"
Exit
End
pat="PAT=#?.#?(htm|html)"
say "Checking: "||dir
void=SetClip("xdir",dir)
directory=dir
if dir~="" then dir=d2c(34)||dir||d2c(34)
address command "list >"TempFile dir pat||" quick nohead files all lformat %s%s"
Time('R')
Datei=0;Fehler=0;Links=0
Open("LCR","T:LinkCheckResult","W")
Open("HTML",TempFile,"R")
DO WHILE 1
htmlfile=ReadLn('HTML')
IF EOF('HTML') THEN leave
poss=max(pos(":",htmlfile),lastpos("/",htmlfile))
verz=left(htmlfile,poss)
help=verz
Datei=Datei+1
ende=0
zeile=0
say d2c(11)||copies(" ",70)||d2c(11)
say "Checking: "DelStr(htmlfile,1,length(directory))
say "Files: "||Datei||" - Links: "||links||" - Errors:
"||Fehler||"
"d2c(11)
Open("CHECK",htmlfile,"R")
DO WHILE ende=0
Do WHILE ende=0
line=Readln('CHECK')
IF EOF('CHECK') THEN ende=1
zeile=zeile+1
DO WHILE 1
raus=0;z=1
pos11=pos('SRC=',upper(line));if pos11=0 then pos11=99999
pos12=pos('HREF=',upper(line));if pos12=0 then pos12=99999
pos1=min(pos11,pos12)
IF pos1=99999 then leave
pos13=min(pos('=',line,pos1),pos('="',line,pos1))
Select
When pos13=0 then pos1=pos('=',line,pos1)
When pos13<pos1+7 then pos1=pos13
Otherwise NOP
End
pos21=pos(d2c(34),line,pos1+2);if pos21=0 then pos21=99999
pos22=pos(" ",line,pos1+2);if pos22=0 then pos22=99999
pos23=pos("#",line,pos1+2);if pos23=0 then pos23=99999
pos24=pos(">",line,pos1+2);if pos24=0 then pos24=99999
pos2=min(pos21,pos22,pos23,pos24)
IF pos2=99999 then leave
link=left(line,pos2-1)
Do While (raus=0&z<7)
Call Extern Ext.z
z=z+1
end
line=Delstr(line,1,pos2+1)
if raus=0 then;do
link=DelStr(link,1,pos1)
link=strip(link,B,d2c(34))
link=strip(link,B,"=")
pos3=0
hilfsverz=left(verz,Length(verz)-1)
Do While 1
pos3=pos("../",link)
if pos3 ~=0 then;do
link=DelStr(link,pos3,pos3+2)
posx=pos(":",hilfsverz)
posy=lastpos("/",hilfsverz)
pos4=max(posx,posy)
if pos4~=0 then hilfsverz=Left(hilfsverz,pos4-1)
help=verz
If pos4~=posx then verz=hilfsverz||"/"
else verz=hilfsverz||":"
end
else leave
End
links=links+1
if exists(verz||link)~=1 then;do
Fehler=Fehler+1
writeln("LCR",htmlfile||" -> "||link||" -> line: "||zeile)
end
say "Files: "||Datei||" - Links: "||links||" - Errors:
"||Fehler||"
"d2c(11)
verz=help
END
END
END
END
Close("CHECK")
END
Close("HTML")
Close("LCR")
Zeit=TIME('E')
address command "delete ram:HTMLfound QUIET"
say "Files: "||Datei||" - Links: "||links||" - Errors:
"||Fehler||"
"
If Fehler~=0 then
say "Sorry. There were link errors. They are listed in T:LinkCheckResult."
else
say "Great. No local link errors :-)"
SAY "Elapsed time: "Zeit" sec."
Open("LCR","T:LinkCheckResult","R")
z=0
File.0=Fehler
Link.0=Fehler
Line.0=Fehler
DO WHILE 1
line=ReadLn('LCR')
IF (EOF('LCR')|line='') THEN leave
z=z+1
pos1=pos(" -> ",line)
pos2=pos(" -> ",line,pos1+1)
File.z=Left(line,pos1)
Link.z=Delstr(line,1,pos1+3);Link.z=Left(Link.z,pos2-pos1-4)
Line.z=Delstr(line,1,pos2+9)
End
Close("LCR")
if z=0 then Call Fini
quit=0;del=0;t=1
Do While quit=0
call rtezrequest("Error: "t"/"Fehler||NL||" File: "File.t||NL||" Link: "Link.t||NL||" Line: "Line.t,"Prev|Next|I know|Leave","» Link Errors «",,fonttag "rtez_defaultresponse = 1",result)
if (result=1&t~=1) then t=t-1
if (result=2&t~=z) then t=t+1
if result=3 then del=1
if result=0 then quit=1
if del=1 then;do
if z~=t then;do
do r=t to z-1
e=r+1
File.r=File.e
Link.r=Link.e
Line.r=Line.e
end
end
else;do
r=t-1
t=t-1
end
File.0=r;if r=0 then quit=1
Link.0=r
Line.0=r
z=z-1
Fehler=Fehler-1
del=0
end
End
exit
Extern:
Parse ARG tag
tagpos=pos(tag,upper(link))
if (tagpos<pos1+7&tagpos~=0) then raus=1
RETURN
Fini:
PARSE PULL Keyword
exit